package com.metacube.questionbank.service.impl;

import static org.junit.Assert.*;

import java.sql.Date;
import java.sql.Timestamp;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Calendar;

import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.TestExecutionListeners;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;

import com.metacube.questionbank.dao.QuestionDAO;
import com.metacube.questionbank.model.Question;

@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(locations="file:WebContent/WEB-INF/dispatcher-servlet.xml")
@TestExecutionListeners


public class QuestionServiceImplTest {

	
	@Autowired
	QuestionDAO questionDao;
	@Test
	public void testGetQuestionByQId() throws ParseException {
		Question question=new Question();
		question.setQuesId(1);
		question.setUserId(1);
		question.setQuestionTitle("DATABSE");
		question.setQuestionDesc("what is DATABASE");
		question.setClosingStatus(false);
				SimpleDateFormat sdf; 
		Calendar cal = Calendar.getInstance();
		@SuppressWarnings("deprecation")
		Date date=new Date(2014-1900,10,19);
		question.setClosingDate(date);
		Timestamp timestamp=new Timestamp(2014-1900, 9, 20, 11, 27, 06, 0);
		question.setQuestionDate(timestamp);
		assertEquals(1, 1);
		Question temp=questionDao.getQuestionByQId(1);
		System.out.println(temp.getQuesId());
		


	}

	/*@Test
	public void testInsertQuestion() {
		fail("Not yet implemented");
	}

	@Test
	public void testGetRelatedQuestions() {
		fail("Not yet implemented");
	}

	@Test
	public void testGetMaxQId() {
		fail("Not yet implemented");
	}

	@Test
	public void testGetUnAnsweredQuestions() {
		fail("Not yet implemented");
	}

	@Test
	public void testGetQuestionGivenByUser() {
		fail("Not yet implemented");
	}
*/
}
